A proposed more secure addition to Conky gmail scripts

I use conky-cli for my status in DWM; furthermore, I use the gmail python script that has been floating around to check my emails (e.g. http://ubuntu-virginia.ubuntuforums.org … ?t=631157).  It had always bothered me that my password was just sitting there, so today I did something about that.  This method essentially replaces any instance where you are using wget.  It's a simple c script which uses libcurl.  Once compiled your password is not just there in plain text, and it's basically a drop in replacement for whatever wget command you are using.
#include <stdio.h>
#include <curl/curl.h>
int main(void)
CURL *curl;
CURLcode res;
curl=curl_easy_init();
if (curl)
curl_easy_setopt(curl, CURLOPT_URL, "https://USER:[email protected]/mail/feed/atom");
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
res=curl_easy_perform(curl);
curl_easy_cleanup(curl);
return 0;
Compile it with gcc and the -lcurl flag.
I don't know exactly how useful this is to anyone.  I am sure someone else has a better solution, but this was quick and easy for me.
Thanks.

measure wrote:Thank you for making the effort to create this; it is impressive.  The obvious question: is there any way around it?
It's not terribly impressive; I thought of using LD_PRELOAD to attack your program while reading the fakeroot man page, confirmed that the attack would work with:
su -c chmod go-r /usr/bin/id
fakeroot id
su -c chmod go+r /usr/bin/id
and then cranked out the easiest attack I could think of using LD_PRELOAD.
No, there is no way around this general class of attack.
measure wrote:The only fault I can see is that you had to know ahead of time I was using curl_easy_setopt to sneak in.  This of course isn't much of a fault, as a truly secure system should be public.  I know very little about C, but I would imagine there are ways around this.  Is there no way in C to make sure that I am using the curl_easy_setopt in curl/curl.h ?  If this can be done, then your exploit can be accounted for.
curl_easy_setopt is not 'in' curl/curl.h; curl/curl.h is a header file, and only contains the function prototype.  The actual code of curl_easy_setopt is in libcurl.so (roughly speaking; actually, libcurl.so itself is a symlink to a symlink to the shared library itself).
As for having to know you were using curl_easy_setopt: replacing that function was just the quickest attack I could code up, given that I had your program's source code.  As I mention in my README, a real attacker would go looking for a pre-prepared shared object and wrapper tool that would dump out all of the target program's code and data from the shared object's startup code (it's not hard; just dump the page containing the program's main function, then dump out the pages before and after that one until SIGSEGV happens).  I would be very surprised if such a tool isn't already widely available.
measure wrote:Either way though, thank you again for going out of your way to do this.  I really appreciate it.
I didn't notice the before-and-after times, but I think it took less than fifteen minutes to implement the attack after I saw the reference to LD_PRELOAD in the fakeroot documentation. 
measure wrote:As you seem to be a creative programmer, here's a challenge (which also somehow selfishly allows me to not learn any C, but get results...hmmm) which may or may not actually be a challenge: can I indeed get the desired information about the curl_easy_setopt I am using? Or any of the functions I use for that matter, I suppose I'd have to be more careful with all of them.  And suppose I could fix this, are there other ways to exploit it?
By 'the desired information about the curl_easy_setopt [you are] using', I assume you mean 'which library's curl_easy_setopt am I using?'.  The answer is no, and the glibc dynamic linker goes to some trouble to keep you from finding that out.  Even if you could, some code in the shared object would run before your program's main function, and that could easily dump out the sensitive areas of your address space.
measure wrote:I ask this not because I think someone wants to steal my email address.  This is of course just out of curiosity at this point; but I appreciate your enthusiasm none-the-less.
The best solution is writing a daemon, and feeding it your password at startup through a pipe.  I don't think you'll be able to do that yourself at the moment; little things like error handling become both more important and trickier to implement properly.
Making your program setuid would keep LD_PRELOAD attacks like mine from working (because ld.so can detect that a program is setuid, and takes some precautions to block the obvious privilege escalation holes), but I don't know whether libcurl has a similar 'feature'.  (If you must do this, make its owner a special account that is not used for any other purpose; do *not* use the 'nobody' account for this program.)

Similar Messages

  • [SOLVED]Conky Gmail Script Incorrect

    The python gmail script on the arch wik no longer works on python3 or python2 for me. This error is shown in wing:
    builtins.ValueError: invalid literal for int() with base 10:
    I'm not sure how to fix the incorrect int value, but I would love to see it fixed and posted to the arch wiki again.
    #Enter your username and password below within double quotes
    # eg. username="username" and password="password"
    username="****"
    password="****"
    com="wget -q -O - https://"+username+":"+password+"@mail.google.com/mail/feed/atom --no-check-certificate"
    temp=os.popen(com)
    msg=temp.read()
    index=msg.find("<fullcount>")
    index2=msg.find("</fullcount>")
    fc=int(msg[index+11:index2])
    if fc==0:
    print("0 new")
    else:
    print(str((fc)+" new"))
    Thanks
    Last edited by duke11235 (2011-11-21 04:55:28)

    Your problem may be with wget.  Try curl:
    com = 'curl -s -u "{}:{}" https://mail.google.com/mail/feed/atom'.format( username, password )
    The url you are using is for the Gmail RSS feed, and it contains a ':'.  The python urllib.request module that lunar used expects that a port number will follow the ':'. That is why lunar's script is failing for you.
    The script I use does not use the RSS feed.  It uses the python IMAP library and connects to imap.gmail.com at port 993.
    #!/usr/bin/env python
    # -*- coding: UTF-8 -*-
    import sys, imaplib
    port = 993
    server = 'imap.gmail.com'
    username = '...'
    passwd = '...'
    imap_server = imaplib.IMAP4_SSL(server, port)
    try:
    imap_server.login(username, passwd)
    except:
    print('?? new')
    sys.exit( 1 )
    typ, data = imap_server.select ('Inbox', True)
    if typ == 'OK':
    total = int(data[0])
    typ, data = imap_server.search (None, 'SEEN')
    if typ == 'OK':
    seen = len(data[0].split())
    print('{}/{} new'.format(total, total - seen))
    if typ != 'OK':
    print('?? new')
    imap_server.logout()

  • From what vendors i can get more security provider in addition oracle seurity provider ??

    hi all    
    need to more security provider that produced by vendors other than oracle         
    please help me
    thanks a lot

    You can develop your own custom providers
    Simple Sample Custom Database Authenticator for Oracle Weblogic Server 11g
    http://weblogic-wonders.com/weblogic/2014/01/13/simple-sample-custom-identity-asserter-weblogic-server-12c/

  • How can I turn off the ability to turn off the phone from the lock screen for more security?

    How can I turn off the ability, to turn off the phone, from the lock screen for more security?

    There is no such option.
    There will be some additional features included with iOS 7.
    http://www.tuaw.com/2013/06/10/ios-7-to-include-security-feature-dubbed-activati on-lock/

  • Every time I try to get on the ipod, it says I have to add more security questions, but none are listed, just two buttons that say submit.

    Every time I try to get on the Ipod games, it says I have to add more security questions, but no questions are listed, just two buttons that say "Submit" and places to put the answers to the unstated questions.  It also asks for a second email address.  It then proceeds to lock up.  Is this a scam of some sort.  There is nothing on the apple website about having additional security questions other than the one, or having a second email to operate the ipod.

    You need to contact Apple to get the questions reset. Click here, phone them, and ask for the Account Security team, or fill out and submit this form.
    Whichever method you use, you probably won't get a response until the 26th. If you absolutely must make a purchase before then, create a new Apple ID; you won't be able to transfer previous purchases or iTunes Store credit to it.
    (95471)

  • Which is less/more secure, Mac OS 10.4.11 or Mac OS 10.6.8?

    I understand that both Mac OS 10.4.11 and Mac OS 10.6.8 have security holes, and that 10.4.11 is no longer supported.  If neither 10.4.11 nor 10.6.8 are supported, and if unpatched vulnerabilities in 10.6.8 are worse than those in 10.4.11, then I presume that, because fewer people use 10.4.11, nobody will attack it, whereas many people use 10.6.8 which makes it more attractive to hackers.
    Therefore, my question is this:  did 10.5.x and/or 10.6.x (and their respective Safari versions) introduce new security vulnerabilities that are not present in 10.4.11, or are all of Snow Leopard's (or Safari 5.1.10's) critical security vulnerabilities inherited from earlier versions such as Tiger?

    Most people would likely disagree with me, & although higher versions of OSX got Security fixes, I think older is or can be made more secure.
    TenFourFox for PPC & Firefox for Intel is a more advanced Browser than Safari in either version.
    I consider Little Snitch essential for security also in 10.4.11 to 10.10.2
    There are also some security fixes for 10.4, 10.5, 10.6 that you can apply yourself, here's a link to Bash fixes & maybe ntpd fixes...
    For 10.4/10.5 PPC...
    http://tenfourfox.blogspot.com/2014/09/bashing-bash-one-more-time-updated.html
    For 10.6...
    http://x704.net/bbs/viewtopic.php?f=12&t=7156&p=89620&hilit=bash#p89620

  • Is more security needed with no default getaway?

    Hi!
    I have base only Arch installation for running one Linux compatible application on it. I wander with two questions.
    Do I need to configure through iptables command to get more security or it is unnecessary as I have no default getaway and have route added for two subnets?
    If using iptables is addhelpful in my case how can I install iptables (my Arch base installation writes "not found")? I need short instruction.
    Thank you!

    ralvez wrote:If your system is connected to a network (LAN) and has NO OPEN ports via services, in other words: you are not running a mail service or Apache server, then just enter "ALL:ALL" in /etc/hosts.deny  and that's all you need.
    My system is connected to Internet directly. I have forwarded one TCP and one UDP port. My DSL modem does not allow me to prevent inbound traffic by its firewall (it is not possible to forward ports for special IP addresses/subnets, ports are always open for all IPs for inbound traffic) This is the reason I removed default getaway in Arch and added two needed subnets (It helped me really. My system was overloaded with unwanted traffic. Now unwanted traffic flow is stopped)
    ralvez wrote:If you want to have ssh access to that box you can add the IP address of the machine you want to allow to connect to that box in /etc/hosts.allow
    What do you mean by "ssh access to that box"?
    ralvez wrote:but if you want to "push" the boundaries any further I would add a firewall via IPTABLES
    Yes, I want more security as possible but do I need it in my case? (I do not know)

  • Is there any way to may my ipad more secure?

    I'm having to change my password at least once a week. I keep getting emails saying my password has been reset am I'm not doing it. I'm them locked out of apple. I have to log on via another computer to reset my password and answer security questions. I've changed my password to many different things, please help me?

    It's not your iPad that needs to be more secure - this is to do with your AppleID.
    Most likely its some (stupid) person mistaking your email address for theirs, and when finding they can't log in to their (your) account, they try to reset the password, which then sends you the email.
    This happens frequently to people with email addresses that are similar to many common names. You'd be surprised how many people can't remember their own email address.
    Unfortunately, there's not a lot you can do to combat people's stupidity. If you do have am easily mistaken email address as your AppleID, perhaps you could try changing it to a less common one...

  • Service Manager 2012 Agentless Monitoring and SQL Servers More secure distribution

    Having both SCSM 2012 and 2012 in my network, I want to monitor the all using a single account which is securely distributed. The problem is agentless monitored servers does not appear in the "more secure" list.
    My Scenario:
    I have scsm 2012 installed with the following condition:
    SCSM Main DB -> Monitored with Agent (not a management server)
    SCSM Data Warehouse -> Agentless monitored
    SCSM Workflow and other Management Servers -> Agentless Monitored
    Some Test SCSM 2012 Servers with SQL on the same machine -> Agentless Monitored
    Some Test and Operational SCSM 2012 Servers -> Agentless Monitored
    I want to use a single account to monitor them all, I have set the "Service Manager Database Account" profile (yet to understand why Service Manager Database
    Account is actually a Profile!) and in the underlying account set the distribution to "more secure" . As stated above, I have many servers with the SQL running on the management serves and I cannot
    configure them in the SQL account.
    Is my scenario wrong?
    Thanks
    YSobhdel

    It seems the SQL MP is monitoring the database on agentless managed computers without my permission!
    All my agentless managed computers are using the default action account to monitor the SQL!
    Any explanation why is that so?
    Thanks
    YSobhdel

  • [svn:fx-4.x] 15178: A few more corrections/ additions to the layoutDirection style ASDoc.

    Revision: 15178
    Revision: 15178
    Author:   [email protected]
    Date:     2010-03-31 12:49:26 -0700 (Wed, 31 Mar 2010)
    Log Message:
    A few more corrections/additions to the layoutDirection style ASDoc.
    QE notes:
    Doc notes: None
    Bugs:
    Reviewed By: Hans
    Tests run: checkintests
    Is noteworthy for integration: No
    Modified Paths:
        flex/sdk/branches/4.x/frameworks/projects/framework/src/mx/core/UIComponent.as

    This is a duplicate post.  This should be locked to avoid further confusion.
    My CSS wont change
    Nancy O.

  • More secure public blog pages

    I have got Snow Leopard Server up and hosting several simple public sites without problems. One of my sites has a blog for public view.
    Previously, this site was hosted elsewhere and the blog ran on MovableType. In MT, Blogger, etc. the url for the public page of the blog is different from the url which is used to edit the blog. Thus, the edit/administration log in page can be configured to use SSL or locked down to reduce attempts at hacking the site, while the public views are simple http. Now that it is migrating to SLS 10.6.4, the public blog page has the log in linking to editing/posting functions.
    There are actually two questions. Is there a way to make this more secure? And, is there an easy way to map the blog to another url such as "blog.mysite.net" ? I have played around with creating a duplicate blog page located in the web root where appropriate <div>'s and parts of the native blog page "www.mysite.net/users/username" are copied and certain links are removed. It's a bit flaky. For example, it you protect the blog using a realm to prevent access then include a <div> from the blog page on a page outside the realm, it may not display. It also takes away log in for posting comments.
    How have you solved similar issues?

    The simple idea is to clean up URLs. I wanted to get a variety of simple URLs to point to my blog. For example, "www.yoursite.url/blog" and "blog.yoursite.url" would all call up "www.yoursite.url/users/blogger/weblog" in the browser.
    In this set of instructions, there is only one blog on the site created by the user "blogger":
    The first (getting "www.yoursite.url/blog" to call "www.yoursite.url/users/blogger/weblog") is simple. In Server Admin -> Sites -> yoursite.net (or whatever) under the Aliases tab, click the "+" under "URL Aliases and Redirects" and create a new Redirect where the pattern is "/blog" and the path is "http://www.yoursite.url/users/blogger/weblog" and click OK. Now Save and restart the Web service.
    The other was a bit more challenging but mod_rewrite comes to the rescue.
    First, you need to set up the DNS servers.
    1. Log in to the DNS control panel of your registrar, ISP, or DNS provider (everydns, dyndns, etc.) and add an A record for blog.mysite.net pointing to the public IP address of your firewall/etc. on which your Snow Leopard Server answers http requests.
    2. In Server Admin, under DNS -> Primary zone -> Add New Record -> Alias which is "blog.yoursite.url" pointing to the IP address or name of your SLS.
    Next, you create a web server alias and then rewrite http request coming in to that alias. The steps are:
    1. Stop Web service in Server Admin.
    2. In Server Admin -> Settings -> Modules, make sure rewrite_module is checked.
    3. In Server Admin -> Web -> Sites, select your "www.yoursite.url" which hosts the blog and under the Aliases tab, click the "+" under the Web Server Aliases field and create the alias "blog.yoursite.url"
    4. Now, in Server Admin -> Web -> Sites, select your "www.yoursite.url" which hosts the blog and under the Options tab, enable "Allow All Overrides" and save.
    5. Next is a bit of rewrite configuration. You need to rewrite http request for "blog.yoursite.url" to "www.yoursite.url/users/blogger." Fire up your terminal and "sudo nano -w /etc/apache2/sites/0005your.ip.add.ress_portwww.yoursite.url.conf, find the <Directory> section which looks like this:
    <Directory "/Library/WebServer/Sites/yoursite.url">
    <IfModule mod_dav.c>
    DAV Off
    </IfModule>
    Options All -Includes -ExecCGI -Indexes +MultiViews
    AllowOverride All
    </Directory>
    Edit this to:
    <Directory "/Library/WebServer/Sites/yoursite.url">
    <IfModule mod_dav.c>
    DAV Off
    </IfModule>
    Options All -Includes -ExecCGI -Indexes +MultiViews +FollowSymlinks
    AllowOverride All
    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^www.* [NC]
    RewriteCond %{HTTP_HOST} ^blog\. [NC]
    RewriteRule ^(.*) http://www.yoursite.url/users/blogger/weblog [R,NC,L]
    </IfModule>
    </Directory>
    Even though mod_rewrite.c is loaded, rewriting will not occur unless the directives "Options +FollowSymlinks" and "RewriteEngine on" are in the conf file or .htaccess file. The first RewriteCond tells the rewrite engine not to attempt rewriting HTTP_HOST requests which start with www. The second RewriteCond checks if the HTTP_POST field begins with "blog." The RewriteRule takes the requested url and rewrites it. Although the url description "^(.*)" matches all urls, we know any http request must be for "www.yoursite.url" or "blog.yoursite.url" because those are the only addresses to which this particular virtual host responds. We excluded "www" so ....]
    6. Now restart the Web service and check it out.

  • Should I upgrade to Macericks now from 10.6.8 on my i-Mac(mid 2007, core 2 duo?). Will Mavericks be more secure than 10.6.8 ? 10.6.8 has been great, it runs great with all my apps but am concerned about future supportibility?

    Should I upgrade to Mavericks now from 10.6.8 (i-Mac, mid 2007, core 2 duo)? Will Mavericks be more secure than 10.6.8 ?  I have the latest version of 10.6.8 and have upgraded my memory to 4GB. This could be one reason for me to make the move now.
    10.6.8 has been great, it runs great with all my apps but am concerned about lack of support now. I know my PC apps will not work but maybe some apps that work now will "walk away" from 10.6.8 and then there's the security question of above.
    I am also concerned about iPhoto 9 transition to i-Photo 11 and compatibility of my Time Machine WD Passport HD (format: Mac OS Extended (Journaled) based on several questions in applicable forums.
    Thanks for your help in this important decision!

    If I were you I would stick with Snow Leopard. It's much better suited to your old hardware. That said:
    Upgrading from Snow Leopard to Lion or Mavericks
    To upgrade to Mavericks you must have Snow Leopard 10.6.8, Lion, or Mountain Lion installed. Purchase and download Mavericks (Free) from the App Store. Sign in using your Apple ID. The file is quite large, over 5 GBs, so allow some time to download. It would be preferable to use Ethernet because it is nearly four times faster than wireless.
         OS X Mavericks- System Requirements
           Macs that can be upgraded to OS X Mavericks
             1. iMac (Mid 2007 or newer) — Model Identifier 7,1 or later
             2. MacBook (Late 2008 Aluminum, or Early 2009 or newer) —
                 Model Identifier 5,1 or later
             3. MacBook Pro (Mid/Late 2007 or newer) — Model Identifier 3,1 or later
             4. MacBook Air (Late 2008 or newer) — Model Identifier 2,1 or later
             5. Mac mini (Early 2009 or newer) — Model Identifier 3,1 or later
             6. Mac Pro (Early 2008 or newer) — Model Identifier 3,1 or later
             7. Xserve (Early 2009) — Model Identifier 3,1 or later
    To find the model identifier open System Profiler in the Utilities folder. It's displayed in the panel on the right.
    Are my applications compatible?
             See App Compatibility Table — RoaringApps.
    Upgrading to Lion
    If your computer does not meet the requirements to install Mavericks, it may still meet the requirements to install Lion.
    You can purchase Lion at the Online Apple Store. The cost is $19.99 (as it was before) plus tax.  It's a download. You will get an email containing a redemption code that you then use at the Mac App Store to download Lion. Save a copy of that installer to your Downloads folder because the installer deletes itself at the end of the installation.
         Lion System Requirements
           1. Mac computer with an Intel Core 2 Duo, Core i3, Core i5, Core i7,
               or Xeon processor
           2. 2GB of memory
           3. OS X v10.6.6 or later (v10.6.8 recommended)
           4. 7GB of available space
           5. Some features require an Apple ID; terms apply.

  • Is it more secure to turn off the DHCP server in router?

    I read that it is more securer to turn off the DHCP server in the router?
    Is this true?

    If you google the question you'll find articles claiming that disabling autmatic DHCP makes a router more secure.  For example: http://netsecurity.about.com/od/quicktip1/qt/qtwifistaticip.htm
    On the other hand, there are articles debunking this (and other ideas) as myths:
    http://www.zdnet.com/blog/ou/the-six-dumbest-ways-to-secure-a-wireless-lan/43

  • Possible to have a different (more secure) password for ARD?

    Is it possible to log in to the remote computer where the administrator has a more secure password (different) from the user who is working on the machine. this for added security.
    And if so how?
    thanks

    May I second this question?
    My 90 year old mother >needs< a blank/nil password to get X off the ground which of course allows easy ARD access, but I'd feel better with a secure password.
    Any suggestion(s) will be appreciated.
    Jen

  • Which browser is more secure for Mavericks?

    Hello, before upgrading to Mavericks I was using Firefox because Safari was no longer up to date. And I really love Firefox.
    But here's my question: Which browser is going to be more secure for me?
    Firefox 28.0 or Safari 7.0.2
    Please let me know.
    Thank you very much!

    Both are very secure,  it's totally your choice though.

Maybe you are looking for

  • Unable to open pdfs after downgrade from PS  CC 2014

    Greetings. Our office has several seats of Creative Cloud, and our workstations are all Macs.  When InDesign and Photoshop upgrades to version 2014 were released, I installed them on our computers; only to discover that the upgrade is not compatible

  • Seagate hardrive no longer shows up on my desktop in Lion

    I have a Seagate 500gb Freeagent hadrdive and recently upgraded to Lion, it no longer shows up on the desktop but does show up in disk utility. Tried a new WD hard drive and that one works fine. Anyone had similar problems or found work arounds?

  • How to find out the path of already existing directory?

    I need to get the exact path of 'FCO_DIR' directory. Could you please help me out with this. Is there any table name or a quey that I can run to get this information? Below is the code that I am using : Code: l_input_dir CONSTANT VARCHAR2 (30) := 'FC

  • How to setup a track for production support in NWDI ??

    Hi, *I have a requirement:* Suppose I am working on a product development, i have finished phase -1 of the development, I moved the changes to QA system and than I moved it to the production. Than I started working on Phase-2 of that product developm

  • Repeated object sending problem

    why when you serialize the same reference multiple times after an internal state change does it not update in the sent copy? meaning , if i have a Tree object with a height parameter , and i send it with height=50 and then i update the same objects (